package com.jinsi.utils;


import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

@Component
public class StuIdUtils {

    public static String getStudentId(){
        SimpleDateFormat formatter= new SimpleDateFormat("yyyyMMdd");
        Date date = new Date();
        String format = formatter.format(date);
        String substring = format.substring(2, 8);
        int max=10000;
        int min=1000;
        Random random = new Random();
        int fileName =  (random.nextInt(max - min) + min + 1);
        String studentId = substring + fileName;
        return studentId;
    }

}
